@layout("/common/_curd/_container.html"){

<style>
	.outer{
		display: flex;
		flex-wrap: wrap;
	}
	.inlist{
		width: 100%;
		margin-top: 15px;
	}
</style>
		<input type="hidden" name="sn_order_inlog.order_id" id="sn_order_inlog" value="${orderId}">
		<input type="hidden" name="sn_order_inlog.g_id" id="_g_id" value="${orderId}">
		<!-- 表单 -->

<div class="outer">
	<div class="inlist">
		<label class="col-sm-2 control-label no-padding-right"> 商品名称 </label>
		<div class="col-sm-9">
			<input type="text" id="_g_name" name="sn_order_inlog.g_name"  placeholder="暂无商品名称" class="form-control">
		</div>
	</div>
	<div class="inlist">
		<label class="col-sm-2 control-label no-padding-right"> 数量 </label>
		<div class="col-sm-9">
			<input type="text" id="_num" name="sn_order_inlog.num"  placeholder="暂无数量" class="form-control">
		</div>
	</div>
	<div class="inlist">
		<label class="col-sm-2 control-label no-padding-right"> 单价 </label>
		<div class="col-sm-9">
			<input type="text" id="_price" name="sn_order_inlog.price" placeholder="暂无单价" class="form-control">
		</div>
	</div>
	<div class="clearfix form-actions center" style="width:100%;margin-top:15px;margin-bottom:5px;">
		<div class="col-md-offset-1 col-md-10">
			<button class="btn btn-info" type="submit" id="btn_save1">
				<i class="ace-icon fa fa-check bigger-110"></i>
				新增
			</button>

			&nbsp; &nbsp; &nbsp;
			<button class="btn" type="button" id="btn_close">
				<i class="ace-icon fa fa-close bigger-110"></i>
				关闭
			</button>
		</div>
	</div>
</div>

<script>
	$(function () {
        $("#btn_close").on("click",function () {
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭
        })
        $("#btn_save1").on("click",function () {
            var ajaxURL = '/${code}/save';
            var ajaxData = {
                "sn_order_inlog.g_name":$("#_g_name").val(),
                "sn_order_inlog.num":$("#_num").val(),
                "sn_order_inlog.g_id":$("#_g_id").val(),
                "sn_order_inlog.price":$("#_price").val(),
                "sn_order_inlog.order_id":${orderId}
			}
            $.post(ajaxURL,ajaxData,function (res) {
                if(res["success"]){
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭
				}
            });

        })
		$("#_g_name").on("click",function () {
            var index = layer.open({
                type: 2,
                title:'选择商品',
                area: ['100%', '100%'],
                maxmin:true,
                shadeClose: true, //点击遮罩关闭
                content:  '/snGoods/choose',
				end:function () {
                    console.log(123)
                }
            });

            this.layerIndex = index;
        })
    })
</script>

@}
